// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CharchaterFilter.java

package com.itheima.travel.web.filter;

import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CharchaterFilter
	implements Filter
{

	public CharchaterFilter()
	{
	}

	public void init(FilterConfig filterconfig)
		throws ServletException
	{
	}

	public void doFilter(ServletRequest req, ServletResponse rep, FilterChain filterChain)
		throws IOException, ServletException
	{
		HttpServletRequest request = (HttpServletRequest)req;
		HttpServletResponse response = (HttpServletResponse)rep;
		String method = request.getMethod();
		if (method.equalsIgnoreCase("post"))
			request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		filterChain.doFilter(request, response);
	}

	public void destroy()
	{
	}
}
